<%+cbi/valueheader%>

<script type="text/javascript">//<![CDATA[
	function act_download_rule(btn,filename)
	{
		btn.disabled = true;
		btn.value    = '<%:Downloading Rule...%> ';
		XHR.get('<%=luci.dispatcher.build_url("admin", "vpn", "openclash","download_rule")%>',
			{
				filename: filename
			},
			function(x,status)
			{
				if ( x && x.status == 200 ) {
					if(status.rule_download_status=="0")
					{
						btn.value = '<%:Download Failed%>';
					}
					else if (status.rule_download_status=="1")
					{
						btn.value = '<%:Download Successful%>';
					}
					else if (status.rule_download_status=="2")
					{
						btn.value = '<%:Rule No Change%>';
					}
				}
				else {
					btn.value = '<%:Download Timeout%>';
				}
			}
		);
		btn.disabled = false;
		return false;
	}
//]]></script>


<input type="button" class="btn cbi-button cbi-input-reload" value="<%:Click to Update%>" onclick="return act_download_rule(this,'<%=self:cfgvalue(section)%>')" />

<%+cbi/valuefooter%>
